package com.vercon.common.view;

import android.content.Context;
import android.graphics.Typeface;

/**
 * Created by yzc on 2018-10-30.
 */

public class FontProvider {

    public static final String english_type = "fonts/DIN_Light.otf";
    public static final String chinese_type = "fonts/alibaba_puhuiti_regular.ttf";
//    public static final String NORMAL_NUMBER = "fonts/SourceHanSansCN-Heavy.otf";

    private static Typeface light;
    private static Typeface regular;

    private static final FontProvider instance = new FontProvider();

    public static FontProvider getInstance(Context context){
        if(null == light){
            light = Typeface.createFromAsset(context.getAssets(), english_type);
        }
        if(null == regular){
            regular =  Typeface.createFromAsset(context.getAssets(), chinese_type);
        }
        return instance;
    }

    private FontProvider() {
    }

    public Typeface getTypeface(String type){
        if(type.equals(english_type)){
            return light;
        }else{
            return regular;
        }
    }

}
